-
Notifications
You must be signed in to change notification settings - Fork 33
feat: Propagate rustdoc to generated (super)state enums #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thank you for your work :)
|
These build failures are really interesting. Both the stable & nightly builds are failing with mismatches in the trybuild It's interesting that the @mdeloof would you mind triggering another GitHub Actions run against https://github.com/mdeloof/statig/tree/refs/heads/main ? I see on this repo's actions page that the last action run against main is from |
|
Yeah, I ran the workflow on - 1 | #![deny(missing_docs)] // EXPECTED
+ 1 | #![deny(missing_docs)] // ACTUAL OUTPUT |
|
I've published #75 which should fix the existing ui tests & then updated the commit in this PR so that the new ui tests' line number matches the right aligned format. |
Problem: `state_machine!()` users could not document their state and superstate handler functions with doc comments that would appear on the generated enum variants. This made the generated code harder to understand, reduced IDE support, and meant users could not use lints like `missing_docs`. Solution: Propagate doc comments through the macro pipeline by extracting them from the state/superstate handler functions during analysis, and then attaching the extracted doc comments as attributes to the generated enum variants. Additionally we added default doc comments to the generated State and Superstate enums. Testing: Added trybuild tests that use `#![deny(missing_docs)]` to validate that the doc comments are propagated.
|
Okay - looks like I mis-staged the actual test fixes for this commit last night. 😅 Things are looking good now though! Thanks for turning on the runners automatically @mdeloof! |
|
Thanks again @ophilli and @christianheussy! |
Problem:
state_machine!()users could not document their state and superstate handler functions with doc comments that would appear on the generated enum variants. This made the generated code harder to understand, reduced IDE support, and meant users could not use lints likemissing_docs.Solution: Propagate doc comments through the macro pipeline by extracting them from the state/superstate handler functions during analysis, and then attaching the extracted doc comments as attributes to the generated enum variants. Additionally we added default doc comments to the generated State and Superstate enums.
Testing: Added trybuild tests that use
#![deny(missing_docs)]to validate that the doc comments are propagated.